import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/version_entity.dart';

VersionEntity $VersionEntityFromJson(Map<String, dynamic> json) {
  final VersionEntity versionEntity = VersionEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    versionEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    versionEntity.msg = msg;
  }
  final VersionData? data = jsonConvert.convert<VersionData>(json['data']);
  if (data != null) {
    versionEntity.data = data;
  }
  return versionEntity;
}

Map<String, dynamic> $VersionEntityToJson(VersionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.toJson();
  return data;
}

extension VersionEntityExtension on VersionEntity {
  VersionEntity copyWith({
    int? code,
    String? msg,
    VersionData? data,
  }) {
    return VersionEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

VersionData $VersionDataFromJson(Map<String, dynamic> json) {
  final VersionData versionData = VersionData();
  final String? versioncode = jsonConvert.convert<String>(json['versioncode']);
  if (versioncode != null) {
    versionData.versioncode = versioncode;
  }
  final String? versionCount = jsonConvert.convert<String>(
      json['versionCount']);
  if (versionCount != null) {
    versionData.versionCount = versionCount;
  }
  final String? versionTime = jsonConvert.convert<String>(json['versionTime']);
  if (versionTime != null) {
    versionData.versionTime = versionTime;
  }
  final String? versionUrl = jsonConvert.convert<String>(json['versionUrl']);
  if (versionUrl != null) {
    versionData.versionUrl = versionUrl;
  }
  return versionData;
}

Map<String, dynamic> $VersionDataToJson(VersionData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['versioncode'] = entity.versioncode;
  data['versionCount'] = entity.versionCount;
  data['versionTime'] = entity.versionTime;
  data['versionUrl'] = entity.versionUrl;
  return data;
}

extension VersionDataExtension on VersionData {
  VersionData copyWith({
    String? versioncode,
    String? versionCount,
    String? versionTime,
    String? versionUrl,
  }) {
    return VersionData()
      ..versioncode = versioncode ?? this.versioncode
      ..versionCount = versionCount ?? this.versionCount
      ..versionTime = versionTime ?? this.versionTime
      ..versionUrl = versionUrl ?? this.versionUrl;
  }
}